//编程Worker类继承自Person类
public class Worker extends Person{
	private int salary;

	public Worker(){
		super();//表示调用父类的无参构造方法
		System.out.println("no Worker");
	}
	public Worker(int age, String name, int salary){
		super(age, name);//表示调用父类的有参构造方法
		System.out.println(" Worker");
		setSaraly(salary);
		setAge(age);
		setName(name);
	}
	public void setSaraly(int salary){

		if (salary >= 2200) {
			this.salary = salary;
		}else{
			System.out.println("工资不合理");
		}
		
	}

	public int getSalary(){
		return this.salary;
	}

	public void work(){
		//虽然可以继承父类的私有成员变量，但是不能直接访问
		// System.out.println(name + "正在搬砖中。。。");
		// System.out.println("都已经" + age + "岁了" + "只有每月" + salary);

		System.out.println(getName() + "正在搬砖中。。。");
		System.out.println("都已经" + getAge() + "岁了" + "只有每月" + salary);
	}
	//方法重写
	@Override
	public void show(){
		super.show();
		System.out.println("我的薪水" + salary );
	}

}